package pers.zc.activiti.hivepool;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * hive连接池配置测试
 */
@Repository
public class HivePoolTest extends HiveJdbcBaseDaoImpl {

    public List<Map<String, Object>> test(){
        String sql = "show bigdata;";
        List<Map<String, Object>> maps = this.getJdbcTemplate().queryForList(sql);
        System.out.println(maps);
        return maps;
    }

    public List<Map<String, Object>> test2(String use,String sql) {
        JdbcTemplate jdbcTemplate = this.getJdbcTemplate();
        jdbcTemplate.execute(use);
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        System.out.println(maps);
        return maps;
    }


    public List<Map<String,Object>> test3(String name,String password){
        JdbcTemplate jdbcTemplate = this.getJdbcTemplate(name, password);
        List<Map<String, Object>> show_databases = jdbcTemplate.queryForList("show databases");
        return show_databases;
    }
}
